package main

import "fmt"

type long struct {
	name string
	age int
	sex byte
}

func (a long) Printinfo(){
	fmt.Printf("a = %+v\n", a)
}

func (b *long) Setinfo(name string, age int, sex byte)  {
	b.sex = sex
	b.name = name
	b.age = age
}

func main()  {
	//调用打印函数
	a := long{"Make", 20, 'm'}
	a.Printinfo()

	//调用修改成员函数，这里要传地址是要加()
	b := long{"C++", 19, 'x'}
	fmt.Printf("b = %+v\n", b)
	(&b).Setinfo("Go", 21, 'm')
	fmt.Printf("b = %+v\n", b)

}